const router = require('koa-router')();
const studyhistory = require('../modules/studyHistory');

//获取数据
router.get('/userstudyhistory',async (ctx,next) => {
    ctx.body = await studyhistory.selectstudyHistory();  
})
//增加数据
router.post('/userstudyhistory',async (ctx,next) => {
    ctx.body = await studyhistory.addstudyHistory(ctx.request.body)
})
//删除数据
router.delete('/userstudyhistory/:history_id/:history_title',async (ctx,next) => {
    ctx.body = await studyhistory.deletestudyHistory(ctx.params);
})
//修改数据
router.put('/userstudyhistory',async (ctx,next) => {
    ctx.body = await studyhistory.putstudyHistory(ctx.request.body)
})

module.exports = router;